package cn.bone.base.boot.demo1;

import cn.bone.base.boot.demo1.servlet.MyServlet;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.boot.web.servlet.ServletRegistrationBean;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;

/**
 * Created by MD-01 on 2016/9/1.
 */
@SpringBootApplication
@ServletComponentScan
public class Main {

    public static void main(String[] args){
        ApplicationContext ctx = SpringApplication.run(Main.class,args);
        System.out.println("Let's inspect the beans provided by Spring Boot:");
        String[] beanNames = ctx.getBeanDefinitionNames();
       /* for(String beanName : beanNames){
            System.out.println(beanName+"-->"+ctx.getBean(beanName).getClass());
        }*/
    }

    @Bean
    public ServletRegistrationBean servletRegistrationBean(){
        return new ServletRegistrationBean(new MyServlet(),"/servlet1/*");
    }

}
